<?php
function User2()
{
  // 	$formshow ='<TABLE BORDER="0">';
   // $formshow.='<TD width="200">User Name';
   // $formshow.='</TD>';
   	$formshow ='</br></br>User Name</br></br>'; 
	$formshow.='<TD><FORM'; 
 	$formshow.='METHOD=POST>';
	$formshow.='<SELECT>';
	$formshow.='<OPTION VALUE="">Choose a User...';
	$formshow.='<OPTION VALUE="1"   >msingh - Mohnish Singh';
	$formshow.='<OPTION VALUE="2"   >kong - Kevin Ong';
	$formshow.='<OPTION VALUE="3"   >gmar - Gaston Manirique';
	$formshow.='</SELECT>';

	$formshow.='<INPUT TYPE=SUBMIT VALUE="Delete User">';
	$formshow.='</FORM>';
	$formshow.= '</TD>';
	
	print $formshow;
}
function User3()
{
  // 	$formshow ='<TABLE BORDER="0">';
   // $formshow.='<TD width="200">User Name';
   // $formshow.='</TD>';
   	$formshow ='</br></br>Employee Name</br></br>'; 
	$formshow.='<TD><FORM'; 
 	$formshow.='METHOD=POST>';
	$formshow.='<SELECT>';
	$formshow.='<OPTION VALUE="">Choose a User...';
	$formshow.='<OPTION VALUE="1"   >Singh, Mohnish';
	$formshow.='<OPTION VALUE="2"   >Ong, Kevin';
	$formshow.='<OPTION VALUE="3"   >Castro, Willie';
	$formshow.='</SELECT>';

	$formshow.='<INPUT TYPE=SUBMIT VALUE="Delete User">';
	$formshow.='</FORM>';
	$formshow.= '</TD>';
	
	print $formshow;
}
//===============================================================================================
function UserForm($submitname, $function)
{
   global $errmsg;

   $username = "";
   $fullname = "";

   if (isset ($_POST["username"]) && ($function == ADDFUNCTION || EDITFUNCTION))
   {
      $username = $_POST["username"];
      $fullname = $_POST["fullname"];
   }


   $formshow  = '<FORM METHOD="POST" ACTION="';
   
   if ($function == ADDFUNCTION)
   {
      $formshow .= 'visitoradded.php">';;
   }
   elseif ($function == EDITFUNCTION)
   {
      $formshow .= 'visitoredited.php">';;
   }
   elseif ($function == DELETEFUNCTION)
   {
      $formshow .= 'deluser.php">';;
   }
   else
   {
      $formshow .= 'inquser.php">';;
   }
   
   $formshow .= '<font color=red>'.$errmsg.'<br><br><br></font>';
   $formshow .= '<TABLE BORDER="0"><TR>';
 //-----------------------------------------------------------------------------------------------------------  
   $formshow .= '<TD width="250">User Name';
   
   if ($function == ADDFUNCTION || $function == EDITFUNCTION)
   {
      $formshow .= '<font color="red">*</font>';
   }

   $formshow .= '</TD>';
	if ($function == ADDFUNCTION) {	
   $formshow .= '<TD><INPUT TYPE="TEXT" NAME="username" SIZE="25" value="'.$username.'" ';
   }
   else
      $formshow .= '<TD><INPUT TYPE="TEXT" NAME="username" SIZE="25" value="msingh" ';

   if ($function == ADDFUNCTION || EDITFUNCTION)
   {
      $formshow .= '></TD></TR>';
   }

//-----------------------------------------------------------------------------------------------------------
   $formshow .= '<TD width="250">Employee ID';
   
   if ($function == ADDFUNCTION || $function == EDITFUNCTION)
   {
      $formshow .= '<font color="red">*</font>';
   }

   $formshow .= '</TD>';
     if ($function == ADDFUNCTION){
   $formshow .= '<TD><INPUT TYPE="TEXT" NAME="username" SIZE="25" value="'.$username.'" ';
	}
	else
	   $formshow .= '<TD><INPUT TYPE="TEXT" NAME="username" SIZE="25" value="10908743" ';

   if ($function == ADDFUNCTION || EDITFUNCTION)
   {
      $formshow .= '></TD></TR>';
   }

//-----------------------------------------------------------------------------------------------------------   
   $formshow .= '<TR><TD>Password';

   if ($function == ADDFUNCTION || $function == EDITFUNCTION)
   {
      $formshow .= '<font color="red">*</font>';
   }

   $formshow .= '</TD>';
   if ($function == ADDFUNCTION){
   $formshow .= '<TD><INPUT TYPE="password" NAME="fullname" SIZE="26" value="'.$fullname.'" ';
	}
	else
	   $formshow .= '<TD><INPUT TYPE="password" NAME="fullname" SIZE="26" value="randomrandom" ';

   if ($function == ADDFUNCTION || $function == EDITFUNCTION)
   {
      $formshow .= '></TD></TR>';
   }
   else
   {
      $formshow .= 'READONLY></TD></TR>';
   }
//-----------------------------------------------------------------------------------------------------------   
   if (($function == ADDFUNCTION) || ($function == EDITFUNCTION))
   {
      $formshow .= '<TR><TD>Confirm Password';

      if ($function == ADDFUNCTION)
      {
         $formshow .= '<font color="red">*</font>';
      }

      $formshow .= '</TD>';
	   if ($function == ADDFUNCTION){
      $formshow .= '<TD><INPUT TYPE="password" NAME="password" SIZE="26"></TD></TR>';
	  }
	  else
	        $formshow .= '<TD><INPUT TYPE="password" NAME="password" SIZE="26" value="randomrandom"></TD></TR>';


   
  }
   $formshow .= '</TABLE></br>';
   if($function == ADDFUNCTION || $function == EDITFUNCTION || $function == DELETEFUNCTION) {
		$formshow .= '<font size=2; color=red> * The following fields are Required</font>';
   }/*
   if (($errmsg != userSaved) && ($function != INQUIREFUNCTION))
   {
      $formshow .= '<P ALIGN=CENTER><BR><BR><INPUT TYPE="SUBMIT" VALUE="'.$submitname.'" NAME="submit"></P>';
   }*/
     if ($function == ADDFUNCTION)
   {
      $formshow .= '<P ALIGN=CENTER><BR><BR><INPUT TYPE="SUBMIT" VALUE="Add User" NAME="submit"></P>';
   }
   else
       {
      $formshow .= '<P ALIGN=CENTER><BR><BR><INPUT TYPE="SUBMIT" VALUE="Edit User" NAME="submit"></P>';
   }
   $formshow .= '</FORM>';

   print $formshow;
}
//=========================================================================================================================================
function showUserForm($submitname, $function)
{
   global $errmsg;
     
   
   $username = "";
   $fullname = "";

   if (isset ($_POST["username"]) && ($function == ADDFUNCTION || EDITFUNCTION))
   {
      $username = $_POST["username"];
      $fullname = $_POST["fullname"];
   }


   $formshow  = '<FORM METHOD="POST" ACTION="';
   
   if ($function == ADDFUNCTION)
   {
      $formshow .= 'visitoradded.php">';;
   }
   elseif ($function == EDITFUNCTION)
   {
      $formshow .= 'visitoredited.php">';;
   }
   elseif ($function == DELETEFUNCTION)
   {
      $formshow .= 'deluser.php">';;
   }
   else
   {
      $formshow .= 'inquser.php">';;
   }
   
   $formshow .= '<font color=red>'.$errmsg.'<br><br><br></font>';
   $formshow .= '<TABLE BORDER="0"><TR>';
 //-----------------------------------------------------------------------------------------------------------  
   $formshow .= '<TD width="250">Visitor ID';
   
   if ($function == ADDFUNCTION || $function == EDITFUNCTION)
   {
      $formshow .= '<font color="red">*</font>';
   }

   $formshow .= '</TD>';
	if ($function == ADDFUNCTION) {	
   $formshow .= '<TD><INPUT TYPE="TEXT" NAME="username" SIZE="26" value="'.$username.'" ';
   }
   else
      $formshow .= '<TD><INPUT TYPE="TEXT" NAME="username" SIZE="26" value="10901256" ';

   if ($function == ADDFUNCTION || EDITFUNCTION)
   {
      $formshow .= '></TD></TR>';
   }

//-----------------------------------------------------------------------------------------------------------
   $formshow .= '<TD width="250">First Name';
   
   if ($function == ADDFUNCTION || $function == EDITFUNCTION)
   {
      $formshow .= '<font color="red">*</font>';
   }

   $formshow .= '</TD>';
     if ($function == ADDFUNCTION){
   $formshow .= '<TD><INPUT TYPE="TEXT" NAME="username" SIZE="26" value="'.$username.'" ';
	}
	else
	   $formshow .= '<TD><INPUT TYPE="TEXT" NAME="username" SIZE="26" value="Mohnish" ';

   if ($function == ADDFUNCTION || EDITFUNCTION)
   {
      $formshow .= '></TD></TR>';
   }

//-----------------------------------------------------------------------------------------------------------   
   $formshow .= '<TR><TD>Last Name';

   if ($function == ADDFUNCTION || $function == EDITFUNCTION)
   {
      $formshow .= '<font color="red">*</font>';
   }

   $formshow .= '</TD>';
   if ($function == ADDFUNCTION){
   $formshow .= '<TD><INPUT TYPE="TEXT" NAME="fullname" SIZE="26" value="'.$fullname.'" ';
	}
	else
	   $formshow .= '<TD><INPUT TYPE="TEXT" NAME="fullname" SIZE="26" value="Singh" ';

   if ($function == ADDFUNCTION || $function == EDITFUNCTION)
   {
      $formshow .= '></TD></TR>';
   }
   else
   {
      $formshow .= 'READONLY></TD></TR>';
   }
//-----------------------------------------------------------------------------------------------------------   
   $formshow .= '<TR><TD>Phone';

   if ($function == ADDFUNCTION || $function == EDITFUNCTION)
   {
      $formshow .= '<font color="red">*</font>';
   }

   $formshow .= '</TD>';
   if ($function == ADDFUNCTION){
   $formshow .= '<TD><INPUT TYPE="TEXT" NAME="fullname" SIZE="26" value="'.$fullname.'" ';
	}
	else
	   $formshow .= '<TD><INPUT TYPE="TEXT" NAME="fullname" SIZE="26" value="09155011279" ';

   if ($function == ADDFUNCTION || $function == EDITFUNCTION)
   {
      $formshow .= '></TD></TR>';
   }
   else
   {
      $formshow .= 'READONLY></TD></TR>';
   }	
//-----------------------------------------------------------------------------------------------------------   
   $formshow .= '<TR><TD>Purpose';

   if ($function == ADDFUNCTION || $function == EDITFUNCTION)
   {
      $formshow .= '<font color="red">*</font>';
   }

   $formshow .= '</TD>';
   if ($function == ADDFUNCTION){
   $formshow .= '<TD><INPUT TYPE="TEXT" NAME="fullname" SIZE="26" value="'.$fullname.'" ';
	}
	else
	   $formshow .= '<TD><INPUT TYPE="TEXT" NAME="fullname" SIZE="26" value="Meeting" ';

   if ($function == ADDFUNCTION || $function == EDITFUNCTION)
   {
      $formshow .= '></TD></TR>';
   }
   else
   {
      $formshow .= 'READONLY></TD></TR>';
   }   

   
   //-----------------------------------------------------------------------------------------------------------   
   if (($function == ADDFUNCTION) || ($function == EDITFUNCTION))
   {
      $formshow .= '<TR><TD>Address';

      if ($function == ADDFUNCTION)
      {
         $formshow .= '<font color="red">*</font>';
      }

      $formshow .= '</TD>';
	   if ($function == ADDFUNCTION){
      $formshow .= '<TD><INPUT TYPE="TEXT" NAME="password" SIZE="80"></TD></TR>';
	  }
	  else
	        $formshow .= '<TD><INPUT TYPE="TEXT" NAME="password" SIZE="80" value="Unit PentHouse, Pacific Plaza, Ayala Avenue, Makati, Metro Manila, Philippines"></TD></TR>';

//-----------------------------------------------------------------------------------------------------------	  
      

	        $formshow .= '<TR><TD>Door #';

      if ($function == ADDFUNCTION)
      {
         $formshow .= '<font color="red">*</font>';
      }

      $formshow .= '</TD>';
       if ($function == ADDFUNCTION){
      $formshow .= '<TD><INPUT TYPE="Text" NAME="confirmpassword" SIZE="26"></TD></TR>';
		}
		else
		      $formshow .= '<TD><INPUT TYPE="Text" NAME="confirmpassword" SIZE="26" value="2"></TD></TR>';

   }
   
   $formshow .= '</TABLE></br>';
   if($function == ADDFUNCTION || $function == EDITFUNCTION || $function == DELETEFUNCTION) {
		$formshow .= '<font size=2; color=red> * The following fields are Required</font>';
   }/*
   if (($errmsg != userSaved) && ($function != INQUIREFUNCTION))
   {
      $formshow .= '<P ALIGN=CENTER><BR><BR><INPUT TYPE="SUBMIT" VALUE="'.$submitname.'" NAME="submit"></P>';
   }*/
     if ($function == ADDFUNCTION)
   {
      $formshow .= '<P ALIGN=CENTER><BR><BR><INPUT TYPE="SUBMIT" VALUE="Add Visitor" NAME="submit"></P>';
   }
   else
       {
      $formshow .= '<P ALIGN=CENTER><BR><BR><INPUT TYPE="SUBMIT"  VALUE="Edit Visitor" NAME="submit"></P>';
   }
   $formshow .= '</FORM>';

   print $formshow;
}
//=========================================================================================================================================
function showUserList($submitname, $function)
{
   global $errmsg;

   $formshow  = '<FORM METHOD="POST" ACTION="';
   
   if ($function == EDITFUNCTION)
   {
      $formshow  .= 'visitoredited.php">';
   }
   elseif ($function == DELETEFUNCTION)
   {
      $formshow  .= 'deluser.php">';
   }
   else
   {
      $formshow  .= 'inquser.php">';
   }
   
   $formshow .= '<font color=red>'.$errmsg.'<br><br><br></font>';
   $formshow .= '<TABLE BORDER="0"><TR>';
   $formshow .= '<TD width="250">User name</font></TD>';
   $formshow .= '<TD><SELECT name="username">';
   $formshow .= UserListFromDBToSelect();
   $formshow .= '</SELECT></TD></TR>';
   $formshow .= '</TABLE>';
   $formshow .= '<P ALIGN=CENTER><BR><BR><INPUT TYPE="SUBMIT" VALUE="'.$submitname.'" NAME="submit"></P>';
   $formshow .= '</FORM>';

   print $formshow;
}
//=========================================================================================================================================
function validateUserForm($submitname)
{
   global $link;
   global $errmsg;
   
   $errmsg = '';

}

?>
